.class public Lcom/xingbook/c/s;
.super Ljava/lang/Object;


# instance fields
.field private a:Ljava/io/OutputStream;


# direct methods
.method public constructor <init>(Ljava/io/OutputStream;)V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    return-void
.end method

.method public static b(Ljava/util/ArrayList;)Ljava/util/ArrayList;
    .locals 13

    const/16 v12, 0x230

    const/4 v6, 0x1

    const/4 v1, 0x0

    new-instance v9, Ljava/util/ArrayList;

    invoke-virtual {p0}, Ljava/util/ArrayList;->size()I

    move-result v0

    invoke-direct {v9, v0}, Ljava/util/ArrayList;-><init>(I)V

    new-instance v10, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v10}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    iput-boolean v1, v10, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z

    new-instance v5, Landroid/graphics/Matrix;

    invoke-direct {v5}, Landroid/graphics/Matrix;-><init>()V

    invoke-virtual {p0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v11

    move v2, v1

    :goto_0
    invoke-interface {v11}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_1

    :cond_0
    :goto_1
    return-object v9

    :cond_1
    invoke-interface {v11}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    move-object v7, v0

    check-cast v7, Ljava/lang/String;

    :try_start_0
    new-instance v0, Landroid/media/ExifInterface;

    invoke-direct {v0, v7}, Landroid/media/ExifInterface;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_4

    const-string v3, "Orientation"

    invoke-virtual {v0, v3, v6}, Landroid/media/ExifInterface;->getAttributeInt(Ljava/lang/String;I)I

    move-result v4

    const-string v3, "ImageWidth"

    invoke-virtual {v0, v3, v1}, Landroid/media/ExifInterface;->getAttributeInt(Ljava/lang/String;I)I

    move-result v3

    const-string v8, "ImageLength"

    invoke-virtual {v0, v8, v1}, Landroid/media/ExifInterface;->getAttributeInt(Ljava/lang/String;I)I

    move-result v0

    packed-switch v4, :pswitch_data_0

    :pswitch_0
    move v0, v3

    move v8, v2

    :goto_2
    if-le v0, v12, :cond_a

    div-int/lit16 v0, v0, 0x230

    move v2, v6

    :goto_3
    div-int/lit8 v3, v0, 0x2

    if-gtz v3, :cond_9

    iput v2, v10, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I

    :try_start_1
    new-instance v3, Ljava/io/FileInputStream;

    new-instance v0, Ljava/io/File;

    invoke-direct {v0, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-direct {v3, v0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_1
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_3

    const/4 v0, 0x0

    invoke-static {v3, v0, v10}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    :try_start_2
    invoke-virtual {v3}, Ljava/io/FileInputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    :goto_4
    if-eqz v0, :cond_0

    const/4 v3, 0x6

    if-eq v4, v3, :cond_2

    const/16 v3, 0x8

    if-ne v4, v3, :cond_b

    :cond_2
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v3

    :goto_5
    invoke-virtual {v5}, Landroid/graphics/Matrix;->reset()V

    if-eqz v8, :cond_3

    int-to-float v4, v8

    invoke-virtual {v5, v4}, Landroid/graphics/Matrix;->postRotate(F)Z

    :cond_3
    if-gt v2, v6, :cond_4

    if-le v3, v12, :cond_5

    :cond_4
    const/high16 v2, 0x440c

    int-to-float v3, v3

    div-float/2addr v2, v3

    invoke-virtual {v5, v2, v2}, Landroid/graphics/Matrix;->postScale(FF)Z

    :cond_5
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v3

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v4

    move v2, v1

    invoke-static/range {v0 .. v6}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;

    move-result-object v2

    if-eqz v2, :cond_6

    invoke-virtual {v2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_6

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    move-object v0, v2

    :cond_6
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v7}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ".thu"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    new-instance v3, Ljava/io/File;

    invoke-direct {v3, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    :try_start_3
    new-instance v2, Ljava/io/FileOutputStream;

    invoke-direct {v2, v3}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
    :try_end_3
    .catch Ljava/io/FileNotFoundException; {:try_start_3 .. :try_end_3} :catch_2

    sget-object v4, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    const/16 v7, 0x50

    invoke-virtual {v0, v4, v7, v2}, Landroid/graphics/Bitmap;->compress(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z

    move-result v4

    if-eqz v4, :cond_7

    invoke-virtual {v9, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    :cond_7
    if-eqz v2, :cond_8

    :try_start_4
    invoke-virtual {v2}, Ljava/io/FileOutputStream;->close()V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_1

    :cond_8
    :goto_6
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->isRecycled()Z

    move-result v2

    if-nez v2, :cond_c

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    move v2, v8

    goto/16 :goto_0

    :pswitch_1
    const/16 v8, 0x5a

    goto/16 :goto_2

    :pswitch_2
    const/16 v8, 0xb4

    move v0, v3

    goto/16 :goto_2

    :pswitch_3
    const/16 v8, 0x10e

    goto/16 :goto_2

    :cond_9
    div-int/lit8 v0, v0, 0x2

    mul-int/lit8 v2, v2, 0x2

    goto/16 :goto_3

    :cond_a
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v9, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto/16 :goto_1

    :catch_0
    move-exception v3

    invoke-virtual {v3}, Ljava/io/IOException;->printStackTrace()V

    goto/16 :goto_4

    :cond_b
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v3

    goto/16 :goto_5

    :catch_1
    move-exception v2

    invoke-virtual {v2}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_6

    :catch_2
    move-exception v0

    goto/16 :goto_1

    :catch_3
    move-exception v0

    goto/16 :goto_1

    :catch_4
    move-exception v0

    goto/16 :goto_1

    :cond_c
    move v2, v8

    goto/16 :goto_0

    :pswitch_data_0
    .packed-switch 0x3
        :pswitch_2
        :pswitch_0
        :pswitch_0
        :pswitch_1
        :pswitch_0
        :pswitch_3
    .end packed-switch
.end method


# virtual methods
.method public a(I)I
    .locals 1

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    invoke-virtual {v0, p1}, Ljava/io/OutputStream;->write(I)V

    const/4 v0, 0x1

    return v0
.end method

.method public a(J)I
    .locals 4

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/32 v1, -0x1000000

    and-long/2addr v1, p1

    const/16 v3, 0x18

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/32 v1, 0xff0000

    and-long/2addr v1, p1

    const/16 v3, 0x10

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/32 v1, 0xff00

    and-long/2addr v1, p1

    const/16 v3, 0x8

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/16 v1, 0xff

    and-long/2addr v1, p1

    const/4 v3, 0x0

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    const/4 v0, 0x4

    return v0
.end method

.method public a(Ljava/io/File;)I
    .locals 6

    const/4 v1, 0x0

    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, p1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    const/16 v0, 0x2000

    new-array v3, v0, [B

    move v0, v1

    :goto_0
    invoke-virtual {v2, v3}, Ljava/io/FileInputStream;->read([B)I

    move-result v4

    const/4 v5, -0x1

    if-ne v4, v5, :cond_0

    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V

    return v0

    :cond_0
    iget-object v5, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    invoke-virtual {v5, v3, v1, v4}, Ljava/io/OutputStream;->write([BII)V

    add-int/2addr v0, v4

    goto :goto_0
.end method

.method public a(Ljava/lang/String;)I
    .locals 3

    const-string v0, "UTF-8"

    invoke-virtual {p1, v0}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v0

    iget-object v1, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    invoke-virtual {v1, v0}, Ljava/io/OutputStream;->write([B)V

    iget-object v1, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Ljava/io/OutputStream;->write(I)V

    array-length v0, v0

    add-int/lit8 v0, v0, 0x1

    return v0
.end method

.method public a(Ljava/util/ArrayList;)I
    .locals 7

    const/4 v2, 0x0

    const/16 v0, 0x2000

    new-array v3, v0, [B

    invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v4

    move v1, v2

    :goto_0
    invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_0

    return v1

    :cond_0
    invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/io/File;

    new-instance v5, Ljava/io/FileInputStream;

    invoke-direct {v5, v0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    move v0, v1

    :goto_1
    invoke-virtual {v5, v3}, Ljava/io/FileInputStream;->read([B)I

    move-result v1

    const/4 v6, -0x1

    if-ne v1, v6, :cond_1

    invoke-virtual {v5}, Ljava/io/FileInputStream;->close()V

    move v1, v0

    goto :goto_0

    :cond_1
    iget-object v6, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    invoke-virtual {v6, v3, v2, v1}, Ljava/io/OutputStream;->write([BII)V

    add-int/2addr v0, v1

    goto :goto_1
.end method

.method public a(Z)I
    .locals 3

    const/4 v1, 0x1

    iget-object v2, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    if-eqz p1, :cond_0

    move v0, v1

    :goto_0
    invoke-virtual {v2, v0}, Ljava/io/OutputStream;->write(I)V

    return v1

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public a()V
    .locals 1

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    invoke-virtual {v0}, Ljava/io/OutputStream;->close()V

    :cond_0
    return-void
.end method

.method public b(J)I
    .locals 4

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/high16 v1, -0x100

    and-long/2addr v1, p1

    const/16 v3, 0x38

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/high16 v1, 0xff

    and-long/2addr v1, p1

    const/16 v3, 0x30

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide v1, 0xff0000000000L

    and-long/2addr v1, p1

    const/16 v3, 0x28

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide v1, 0xff00000000L

    and-long/2addr v1, p1

    const/16 v3, 0x20

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/32 v1, -0x1000000

    and-long/2addr v1, p1

    const/16 v3, 0x18

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/32 v1, 0xff0000

    and-long/2addr v1, p1

    const/16 v3, 0x10

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/32 v1, 0xff00

    and-long/2addr v1, p1

    const/16 v3, 0x8

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    iget-object v0, p0, Lcom/xingbook/c/s;->a:Ljava/io/OutputStream;

    const-wide/16 v1, 0xff

    and-long/2addr v1, p1

    const/4 v3, 0x0

    ushr-long/2addr v1, v3

    long-to-int v1, v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write(I)V

    const/4 v0, 0x4

    return v0
.end method
